// subPages/bodyFat/analysis/analysis.js
const app = getApp()
var util =  require('../../../utils/util.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    low: '<',
    height: '>',
    isShow: false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    if(options.item != 'undefined' && options.item != null)
    {
      this.setData({
        isNewUser: 2,
        userInfo: JSON.parse(options.item)
      })
      wx.setNavigationBarTitle({
        title: this.data.userInfo.nickName + '的数据分析' //页面标题为路由参数
      })
    }else{
      this.setData({
        isNewUser: 1,
        userInfo: app.globalData.userInfo,
      })
    }
    this.getAnalyisList(options);
  },
  
  getAnalyisList(options){
    var that = this
    wx.request({
        url: app.globalData.apiUrl +'/checkinfo',
        data: {
          id: options.id,
        },
        method: 'get',
        header: {
          'content-type': 'application/json' //默认值
        },
        success: function (res) {
          // console.log(res);
          if(res.statusCode == 200){
            that.setData({
              normalList:res.data.bz,
              heightList:res.data.height,
              lowList:res.data.low,
              createtime: util.setTime(res.data.createtime),
              normalindex:res.data.bz.length,
              heightindex:res.data.height.length,
              lowindex:res.data.low.length,
            })
            that.setNormalMeasuringRange(that.data.normalList)
            that.setheightMeasuringRange(that.data.heightList)
            that.setlowMeasuringRange(that.data.lowList)
            that.setBzUtil(that.data.normalList);
            that.setLowUtil(that.data.lowList);
            that.setHeightUtil(that.data.heightList);
          }
        },
        fail: function (res) {
          console.log("失败");
        }
    })
  },

  //设置正常列表的区间
  setNormalMeasuringRange:function(normalList){
    var that = this
    for(var i in normalList)
    {
      if(normalList[i].title == '体重')
      {
        var isShow = "normalList[" + i + "].isShow"
        var imgsrc = "normalList[" + i + "].imgsrc"
        var titleImgSrc = "normalList[" + i + "].titleImgSrc"
        var MeasuringRange = "normalList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/weight.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(normalList[i].title == 'BMI')
      {
        var isShow = "normalList[" + i + "].isShow"
        var imgsrc = "normalList[" + i + "].imgsrc"
        var titleImgSrc = "normalList[" + i + "].titleImgSrc"
        var MeasuringRange = "normalList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/bmi.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(normalList[i].title == '体脂率')
      {
        var isShow = "normalList[" + i + "].isShow"
        var imgsrc = "normalList[" + i + "].imgsrc"
        var titleImgSrc = "normalList[" + i + "].titleImgSrc"
        var MeasuringRange = "normalList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/bodyFat.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(normalList[i].title == '肌肉量')
      {
        
        var isShow = "normalList[" + i + "].isShow"
        var imgsrc = "normalList[" + i + "].imgsrc"
        var titleImgSrc = "normalList[" + i + "].titleImgSrc"
        var MeasuringRange = "normalList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/muscleMass.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(normalList[i].title == '体年龄')
      {
        var isShow = "normalList[" + i + "].isShow"
        var imgsrc = "normalList[" + i + "].imgsrc"
        var titleImgSrc = "normalList[" + i + "].titleImgSrc"
        var MeasuringRange = "normalList[" + i + "].MeasuringRange"
        var low = "normalList[" + i + "].low"
        var height = "normalList[" + i + "].height"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/bodyAge.png',
          [MeasuringRange]: 'MeasuringRange2',
          [low]: '<',
          [height]: '>'
        })
      }
      if(normalList[i].title == '水分率')
      {
        var isShow = "normalList[" + i + "].isShow"
        var imgsrc = "normalList[" + i + "].imgsrc"
        var titleImgSrc = "normalList[" + i + "].titleImgSrc"
        var MeasuringRange = "normalList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/waterContent.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(normalList[i].title == '内脏脂肪')
      {
        var isShow = "normalList[" + i + "].isShow"
        var imgsrc = "normalList[" + i + "].imgsrc"
        var titleImgSrc = "normalList[" + i + "].titleImgSrc"
        var MeasuringRange = "normalList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/visceralFatRate.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(normalList[i].title == '骨量')
      {
        var isShow = "normalList[" + i + "].isShow"
        var imgsrc = "normalList[" + i + "].imgsrc"
        var titleImgSrc = "normalList[" + i + "].titleImgSrc"
        var MeasuringRange = "normalList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/skeletonContent.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(normalList[i].title == '基础代谢')
      {
        var isShow = "normalList[" + i + "].isShow"
        var imgsrc = "normalList[" + i + "].imgsrc"
        var titleImgSrc = "normalList[" + i + "].titleImgSrc"
        var MeasuringRange = "normalList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/bmr.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(normalList[i].title == '蛋白质率')
      {
        var isShow = "normalList[" + i + "].isShow"
        var imgsrc = "normalList[" + i + "].imgsrc"
        var titleImgSrc = "normalList[" + i + "].titleImgSrc"
        var MeasuringRange = "normalList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/protein.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
    }
  },

  //设置偏高列表的区间
  setheightMeasuringRange:function(heightList){
    var that = this
    for(var i in heightList)
    {
      if(heightList[i].title == '体重')
      {
        var isShow = "heightList[" + i + "].isShow"
        var imgsrc = "heightList[" + i + "].imgsrc"
        var titleImgSrc = "heightList[" + i + "].titleImgSrc"
        var MeasuringRange = "heightList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/weight.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(heightList[i].title == 'BMI')
      {
        var isShow = "heightList[" + i + "].isShow"
        var imgsrc = "heightList[" + i + "].imgsrc"
        var titleImgSrc = "heightList[" + i + "].titleImgSrc"
        var MeasuringRange = "heightList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/bmi.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(heightList[i].title == '体脂率')
      {
        var isShow = "heightList[" + i + "].isShow"
        var imgsrc = "heightList[" + i + "].imgsrc"
        var titleImgSrc = "heightList[" + i + "].titleImgSrc"
        var MeasuringRange = "heightList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/bodyFat.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(heightList[i].title == '肌肉量')
      {
        var isShow = "heightList[" + i + "].isShow"
        var imgsrc = "heightList[" + i + "].imgsrc"
        var titleImgSrc = "heightList[" + i + "].titleImgSrc"
        var MeasuringRange = "heightList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/muscleMass.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(heightList[i].title == '体年龄')
      {
        var isShow = "heightList[" + i + "].isShow"
        var imgsrc = "heightList[" + i + "].imgsrc"
        var titleImgSrc = "heightList[" + i + "].titleImgSrc"
        var MeasuringRange = "heightList[" + i + "].MeasuringRange"
        var low = "heightList[" + i + "].low"
        var height = "heightList[" + i + "].height"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/bodyAge.png',
          [MeasuringRange]: 'MeasuringRange2',
          [low]: '<',
          [height]: '>'
        })
      }
      if(heightList[i].title == '水分率')
      {
        var isShow = "heightList[" + i + "].isShow"
        var imgsrc = "heightList[" + i + "].imgsrc"
        var titleImgSrc = "heightList[" + i + "].titleImgSrc"
        var MeasuringRange = "heightList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/waterContent.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(heightList[i].title == '内脏脂肪')
      {
        var isShow = "heightList[" + i + "].isShow"
        var imgsrc = "heightList[" + i + "].imgsrc"
        var titleImgSrc = "heightList[" + i + "].titleImgSrc"
        var MeasuringRange = "heightList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/visceralFatRate.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(heightList[i].title == '骨量')
      {
        var isShow = "heightList[" + i + "].isShow"
        var imgsrc = "heightList[" + i + "].imgsrc"
        var titleImgSrc = "heightList[" + i + "].titleImgSrc"
        var MeasuringRange = "heightList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/skeletonContent.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(heightList[i].title == '基础代谢')
      {
        var isShow = "heightList[" + i + "].isShow"
        var imgsrc = "heightList[" + i + "].imgsrc"
        var titleImgSrc = "heightList[" + i + "].titleImgSrc"
        var MeasuringRange = "heightList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/bmr.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(heightList[i].title == '蛋白质率')
      {
        var isShow = "heightList[" + i + "].isShow"
        var imgsrc = "heightList[" + i + "].imgsrc"
        var titleImgSrc = "heightList[" + i + "].titleImgSrc"
        var MeasuringRange = "heightList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/protein.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
    }
  },

  //设置偏低列表的区间
  setlowMeasuringRange:function(lowList){
    var that = this
    for(var i in lowList)
    {
      if(lowList[i].title == '体重')
      {
        var isShow = "lowList[" + i + "].isShow"
        var imgsrc = "lowList[" + i + "].imgsrc"
        var titleImgSrc = "lowList[" + i + "].titleImgSrc"
        var MeasuringRange = "lowList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/weight.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(lowList[i].title == 'BMI')
      {
        var isShow = "lowList[" + i + "].isShow"
        var imgsrc = "lowList[" + i + "].imgsrc"
        var titleImgSrc = "lowList[" + i + "].titleImgSrc"
        var MeasuringRange = "lowList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/bmi.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(lowList[i].title == '体脂率')
      {
        var isShow = "lowList[" + i + "].isShow"
        var imgsrc = "lowList[" + i + "].imgsrc"
        var titleImgSrc = "lowList[" + i + "].titleImgSrc"
        var MeasuringRange = "lowList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/bodyFat.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(lowList[i].title == '肌肉量')
      {
        var isShow = "lowList[" + i + "].isShow"
        var imgsrc = "lowList[" + i + "].imgsrc"
        var titleImgSrc = "lowList[" + i + "].titleImgSrc"
        var MeasuringRange = "lowList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/muscleMass.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(lowList[i].title == '体年龄')
      {
        var isShow = "lowList[" + i + "].isShow"
        var imgsrc = "lowList[" + i + "].imgsrc"
        var titleImgSrc = "lowList[" + i + "].titleImgSrc"
        var MeasuringRange = "lowList[" + i + "].MeasuringRange"
        var low = "lowList[" + i + "].low"
        var height = "lowList[" + i + "].height"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/bodyAge.png',
          [MeasuringRange]: 'MeasuringRange2',
          [low]: '<',
          [height]: '>'
        })
      }
      if(lowList[i].title == '水分率')
      {
        var isShow = "lowList[" + i + "].isShow"
        var imgsrc = "lowList[" + i + "].imgsrc"
        var titleImgSrc = "lowList[" + i + "].titleImgSrc"
        var MeasuringRange = "lowList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/waterContent.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(lowList[i].title == '内脏脂肪')
      {
        var isShow = "lowList[" + i + "].isShow"
        var imgsrc = "lowList[" + i + "].imgsrc"
        var titleImgSrc = "lowList[" + i + "].titleImgSrc"
        var MeasuringRange = "lowList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/visceralFatRate.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(lowList[i].title == '骨量')
      {
        var isShow = "lowList[" + i + "].isShow"
        var imgsrc = "lowList[" + i + "].imgsrc"
        var titleImgSrc = "lowList[" + i + "].titleImgSrc"
        var MeasuringRange = "lowList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/skeletonContent.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(lowList[i].title == '基础代谢')
      {
        var isShow = "lowList[" + i + "].isShow"
        var imgsrc = "lowList[" + i + "].imgsrc"
        var titleImgSrc = "lowList[" + i + "].titleImgSrc"
        var MeasuringRange = "lowList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/bmr.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
      if(lowList[i].title == '蛋白质率')
      {
        var isShow = "lowList[" + i + "].isShow"
        var imgsrc = "lowList[" + i + "].imgsrc"
        var titleImgSrc = "lowList[" + i + "].titleImgSrc"
        var MeasuringRange = "lowList[" + i + "].MeasuringRange"
        that.setData({
          [isShow]: false,
          [imgsrc]: '/resources/down.png',
          [titleImgSrc]: '/resources/icon/protein.png',
          [MeasuringRange]: 'MeasuringRange1'
        })
      }
    }
  },

  //设置单位（标准）
  setBzUtil:function(normalList){
    var that = this
    for(var i in normalList){
      if(normalList[i].title == '体重')
      {
        var util = "normalList[" + i + "].util"
        that.setData({
          [util]: 'kg',
        })
      }
      if(normalList[i].title == 'BMI')
      {
        var util = "normalList[" + i + "].util"
        that.setData({
          [util]: '',
        })
      }
      if(normalList[i].title == '体脂率')
      {
        var util = "normalList[" + i + "].util"
        that.setData({
          [util]: '%',
        })
      }
      if(normalList[i].title == '肌肉量')
      {
        var util = "normalList[" + i + "].util"
        that.setData({
          [util]: 'kg',
        })
      }
      if(normalList[i].title == '体年龄')
      {
        var util = "normalList[" + i + "].util"
        that.setData({
          [util]: '岁',
        })
      }
      if(normalList[i].title == '水分率')
      {
        var util = "normalList[" + i + "].util"
        that.setData({
          [util]: '%',
        })
      }
      if(normalList[i].title == '内脏脂肪')
      {
        var util = "normalList[" + i + "].util"
        that.setData({
          [util]: '',
        })
      }
      if(normalList[i].title == '骨量')
      {
        var util = "normalList[" + i + "].util"
        that.setData({
          [util]: 'kg',
        })
      }
      if(normalList[i].title == '基础代谢')
      {
        var util = "normalList[" + i + "].util"
        that.setData({
          [util]: 'kcal',
        })
      }
      if(normalList[i].title == '蛋白质率')
      {
        var util = "normalList[" + i + "].util"
        that.setData({
          [util]: '%',
        })
      }
    }
  },

  //设置单位（偏低）
  setLowUtil:function(lowList){
    var that = this
    for(var i in lowList){
      if(lowList[i].title == '体重')
      {
        var util = "lowList[" + i + "].util"
        that.setData({
          [util]: 'kg',
        })
      }
      if(lowList[i].title == 'BMI')
      {
        var util = "lowList[" + i + "].util"
        that.setData({
          [util]: '',
        })
      }
      if(lowList[i].title == '体脂率')
      {
        var util = "lowList[" + i + "].util"
        that.setData({
          [util]: '%',
        })
      }
      if(lowList[i].title == '肌肉量')
      {
        var util = "lowList[" + i + "].util"
        that.setData({
          [util]: 'kg',
        })
      }
      if(lowList[i].title == '体年龄')
      {
        var util = "lowList[" + i + "].util"
        that.setData({
          [util]: '岁',
        })
      }
      if(lowList[i].title == '水分率')
      {
        var util = "lowList[" + i + "].util"
        that.setData({
          [util]: '%',
        })
      }
      if(lowList[i].title == '内脏脂肪')
      {
        var util = "lowList[" + i + "].util"
        that.setData({
          [util]: '',
        })
      }
      if(lowList[i].title == '骨量')
      {
        var util = "lowList[" + i + "].util"
        that.setData({
          [util]: 'kg',
        })
      }
      if(lowList[i].title == '基础代谢')
      {
        var util = "lowList[" + i + "].util"
        that.setData({
          [util]: 'kcal',
        })
      }
      if(lowList[i].title == '蛋白质率')
      {
        var util = "lowList[" + i + "].util"
        that.setData({
          [util]: '%',
        })
      }
    }
  },

  //设置单位（偏高）
  setHeightUtil:function(heightList){
    var that = this
    for(var i in heightList){
      if(heightList[i].title == '体重')
      {
        var util = "heightList[" + i + "].util"
        that.setData({
          [util]: 'kg',
        })
      }
      if(heightList[i].title == 'BMI')
      {
        var util = "heightList[" + i + "].util"
        that.setData({
          [util]: '',
        })
      }
      if(heightList[i].title == '体脂率')
      {
        var util = "heightList[" + i + "].util"
        that.setData({
          [util]: '%',
        })
      }
      if(heightList[i].title == '肌肉量')
      {
        var util = "heightList[" + i + "].util"
        that.setData({
          [util]: 'kg',
        })
      }
      if(heightList[i].title == '体年龄')
      {
        var util = "heightList[" + i + "].util"
        that.setData({
          [util]: '岁',
        })
      }
      if(heightList[i].title == '水分率')
      {
        var util = "heightList[" + i + "].util"
        that.setData({
          [util]: '%',
        })
      }
      if(heightList[i].title == '内脏脂肪')
      {
        var util = "heightList[" + i + "].util"
        that.setData({
          [util]: '',
        })
      }
      if(heightList[i].title == '骨量')
      {
        var util = "heightList[" + i + "].util"
        that.setData({
          [util]: 'kg',
        })
      }
      if(heightList[i].title == '基础代谢')
      {
        var util = "heightList[" + i + "].util"
        that.setData({
          [util]: 'kcal',
        })
      }
      if(heightList[i].title == '蛋白质率')
      {
        var util = "heightList[" + i + "].util"
        that.setData({
          [util]: '%',
        })
      }
    }
  },

  //点击显示内容
  showContent:function(e){
    var that = this 
    var index = e.currentTarget.dataset.indx
    if(e.currentTarget.dataset.main == "标准"){
      var bz = that.data.normalList;
      if(bz[index].isShow == false)
      {
        bz[index].isShow = true;
        bz[index].imgsrc = '/resources/up.png'
      }
      else{
        bz[index].isShow = false;
        bz[index].imgsrc = '/resources/down.png'
      }
      that.setData({
        normalList: bz
      })
    }
    if(e.currentTarget.dataset.main == "偏高"){
      var height = that.data.heightList;
      if(height[index].isShow == false)
      {
        height[index].isShow = true;
        height[index].imgsrc = '/resources/up.png'
      }
      else{
        height[index].isShow = false;
        height[index].imgsrc = '/resources/down.png'
      }
      that.setData({
        heightList: height
      })
    }
    if(e.currentTarget.dataset.main == "偏低"){
      var low = that.data.lowList;
      if(low[index].isShow == false)
      {
        low[index].isShow = true;
        low[index].imgsrc = '/resources/up.png'
      }
      else{
        low[index].isShow = false;
        low[index].imgsrc = '/resources/down.png'
      }
      that.setData({
        lowList: low
      })
    }
    // that.setData({
    //   isShow: !that.data.isShow
    // })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
  
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    return {
      title: 'PAPN小程序',
      path: 'pages/index/index?puid=' + app.globalData.userId,
      success: function(res) {
          res.shareTickets 
      },
      fail: function(res) {
          console.log(res)
      }
    }
  }
})